package com.chanzany.principle.dependenceInversion.improve;

public class DependenceInversion {
    public static void main(String[] args) {
        IReceiver wechat = new Wechat();
        IReceiver emai = new Email();
        new Person().receive(wechat);
        new Person().receive(emai);
    }
}
interface IReceiver{
    String getInfo();
}
class Email implements IReceiver{
    public String getInfo(){return "email: hello world";}
}
class Wechat implements IReceiver{
    public String getInfo(){return "wechat: hello world";}
}

class Person{
    public void receive(IReceiver receiver){
        System.out.println(receiver.getInfo());
    }
}
